package com.example.springbootmybatisplus.controller;

import com.example.springbootmybatisplus.entity.User;
import com.example.springbootmybatisplus.mapper.UserMapper;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @Resource
    private UserMapper userMapper;

    @PostMapping("save")
    public String save() {
        User user = new User();
        user.setName("zhongxc");
        user.setAge(20);
        user.setEmail("zhongxc2me@outlook.com");
        int flag = userMapper.insert(user);
        return flag >= 1 ? "添加成功" : "添加失败";
    }

}
